<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2019/1/12
 * Time: 17:29
 */
$redis = new swoole_redis();
$redis->connect('127.0.0.1',6379,function (swoole_redis $redis,$result){
    if(false === $result){
        echo "connect to redis server failed.\n";
        var_dump($redis->errCode,$redis->errMsg);
        return;
    }
    echo "redis connect success";
//    $redis->set('test',time(),function (swoole_redis $redis,$re){
//        var_dump($re);
//    });
    $redis->get('test',function (swoole_redis $redis,$re){
        var_dump($re);
        $redis->close();
    });
});